﻿using CSRedis;
using Newtonsoft.Json;
using QskjLibrary;
using QskjServiceKafka.Dto;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QskjServiceKafka.Service
{
    public class ZtCarDataUpdate
    {
        /// <summary>
        /// token
        /// </summary>
        public static string? token { get; set; }
        public static CSRedisClient? cSRedisClient5 { get; set; }

        /// <summary>
        /// 中台出租车基础数据
        /// </summary>
        public static void UpdateCarData()
        {
            if (string.IsNullOrEmpty(token))
            {
                ZtTokenDataInfo response = JsonConvert.DeserializeObject<ZtTokenDataInfo>(HttpHelper.GetZtToken().Result);
                if (response == null)
                {
                    Console.WriteLine("获取token失败response为空");
                    return;
                }
                if (string.IsNullOrEmpty(response.data))
                {
                    Console.WriteLine("获取token失败response.data为空");
                    return;
                }
                token = response.data;
            }
            try
            {
                //出租数据
                //string dtStrPre = DateTime.Now.AddDays(-5).ToString("yyyyMMdd");
                //string sqlPre = $@"drop table if exists qskjrecord.B_TaxiZT{dtStrPre}";
                //MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, sqlPre);
                string dtStr = DateTime.Now.ToString("yyyyMMdd");
                if (DateTime.Now.Hour < 7)
                {
                    string exists = $@"SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'qskjrecord' AND TABLE_NAME = 'B_TaxiZT{dtStr}';";
                    object resExi = MySqlHelper.ExecuteScalar(CommandType.Text, exists);
                    if (resExi == null || resExi == DBNull.Value)
                    {
                        string sql = $@"create table IF NOT EXISTS qskjrecord.B_TaxiZT{dtStr}
                        (
                           id                   bigint not null auto_increment,
                           code            varchar(50),
                           car_color            varchar(50),
                           car_numbers          varchar(50),
                           dep                  varchar(50),
                           supply_name          varchar(50),
                           activation_date      varchar(50),
                           car_assets_name_name varchar(50), 
                           car_num         varchar(50), 
                           accountname         varchar(50), 
                           business_unit         varchar(50), 
                           shortname         varchar(50), 
                           primary key (id)
                        );";
                        MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, sql);
                    }
                    //string sqlPreBus = $@"drop table if exists qskjrecord.B_BusZT{dtStrPre}";
                    //MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, sqlPreBus);
                    string exists1 = $@"SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'qskjrecord' AND TABLE_NAME = 'B_BusZT{dtStr}';";
                    object resExi1 = MySqlHelper.ExecuteScalar(CommandType.Text, exists1);
                    if (resExi1 == null || resExi1 == DBNull.Value)
                    {
                        string sqlBus = $@"create table IF NOT EXISTS qskjrecord.B_BusZT{dtStr}
                        (
                           id                   bigint not null auto_increment,
                           supply_name              varchar(50),
                           code         varchar(50),
                           activation_date                 varchar(500),
                           car_color                  varchar(50),
                           car_assets_name_name        varchar(50),
                           dep                  varchar(50),
                           car_numbers             varchar(50),  
                           car_num                 varchar(50),  
                           accountname         varchar(50), 
                           business_unit         varchar(50), 
                           shortname         varchar(50), 
                           primary key (id)
                        );";
                        MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, sqlBus);
                    }
                }

                string sqlCount = $@"select count(*) from qskjrecord.B_BusZT{dtStr}";
                if (Convert.ToInt32(MySqlHelper.ExecuteScalar(CommandType.Text, sqlCount)) > 0)
                {
                    Console.WriteLine(DateTime.Now + "中台《出租车》数据已读取成功");
                    return;
                }
                //读取中台出租车数据
                var str = HttpHelper.GetZtCar(token).Result;
                ZtDataObj<ZtDataResInfo> obj = JsonConvert.DeserializeObject<ZtDataObj<ZtDataResInfo>>(str);
                if (obj == null || obj.data == null || string.IsNullOrEmpty(obj.data.total) || obj.data.total == "0")
                {
                    Console.WriteLine(DateTime.Now + "读取中台出租车数据" + str);
                }
                foreach (var item in obj.data.dataArray)
                {
                    string insertSql = $@"insert into qskjrecord.B_TaxiZT{dtStr}(code,car_color,car_numbers,dep,supply_name,activation_date,car_assets_name_name,car_num,accountname,business_unit,shortname)
                                        values('{item.code}','{item.car_color}','{item.car_numbers}','{item.dep}','{item.supply_name}','{item.activation_date}','{item.car_assets_name_name}','{item.car_numbers.Substring(1)}','{item.accountname}','{item.business_unit}','{item.shortname}')";
                    MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, insertSql);
                }
                //大巴数据
                //ZtDataObj<ZtBusData> objBus = JsonConvert.DeserializeObject<ZtDataObj<ZtBusData>>(str);
                foreach (var item in obj.data.dataArray)
                {
                    string insertSql = $@"insert into qskjrecord.B_BusZT{dtStr}(supply_name,code,activation_date,car_color,car_assets_name_name,dep,car_numbers,car_num,accountname,business_unit,shortname)
                                        values('{item.supply_name}','{item.code}','{item.activation_date}','{item.car_color}','{item.car_assets_name_name}','{item.dep}','{item.car_numbers}','{item.car_numbers.Substring(1)}','{item.accountname}','{item.business_unit}','{item.shortname}')";
                    MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, insertSql);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("读取中台出租车信息异常：" + e.Message);
            }
        }

        /// <summary>
        /// 中台《出租车驾驶员绑定》基础数据
        /// </summary>
        public static void UpdateCarDriverData()
        {
            if (string.IsNullOrEmpty(token))
            {
                ZtTokenDataInfo response = JsonConvert.DeserializeObject<ZtTokenDataInfo>(HttpHelper.GetZtToken().Result);
                if (response == null)
                {
                    Console.WriteLine("获取token失败");
                    return;
                }
                token = response.data;
                if (string.IsNullOrEmpty(response.data))
                {
                    Console.WriteLine("获取token失败");
                    return;
                }
            }
            try
            {
                //出租数据
                if (cSRedisClient5 == null)
                {
                    cSRedisClient5 = RedisHelp.GetInstance5();
                }
                //string dtStrPre = DateTime.Now.AddDays(-5).ToString("yyyyMMdd");
                //string sqlPre = $@"drop table if exists qskjrecord.B_TaxiCarDriverZT{dtStrPre}";
                //MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, sqlPre);
                string dtStr = DateTime.Now.ToString("yyyyMMdd");
                if (DateTime.Now.Hour < 7)
                {
                    string exists = $@"SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'qskjrecord' AND TABLE_NAME = 'B_TaxiCarDriverZT{dtStr}';";
                    object resExi = MySqlHelper.ExecuteScalar(CommandType.Text, exists);
                    if (resExi == null || resExi == DBNull.Value)
                    {
                        string sql = $@"create table IF NOT EXISTS qskjrecord.B_TaxiCarDriverZT{dtStr}
                        (
                           id                   bigint not null auto_increment,
                           car_numbers            varchar(50),
                           name                 varchar(50),
                           permit_number          varchar(50),
                           day_no                  varchar(50),
                           month_hudi           varchar(50),
                           duty_type            varchar(50), 
                           primary key (id)
                        );";
                        MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, sql);
                    }
                    //string sqlPreBus = $@"drop table if exists qskjrecord.B_BusDriverBindZT{dtStrPre}";
                    //MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, sqlPreBus);
                    string exists1 = $@"SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'qskjrecord' AND TABLE_NAME = 'B_BusDriverBindZT{dtStr}';";
                    object resExi1 = MySqlHelper.ExecuteScalar(CommandType.Text, exists1);
                    if (resExi1 == null || resExi1 == DBNull.Value)
                    {
                        string sqlBus = $@"create table IF NOT EXISTS qskjrecord.B_BusDriverBindZT{dtStr}
                        (
                           id                   bigint not null auto_increment,
                           duty_type              varchar(50),
                           permit_number         varchar(50),
                           day_no                 varchar(500),
                           name                  varchar(50),
                           month_hudi        varchar(50),
                           car_numbers                  varchar(50), 
                           primary key (id)
                        );";
                        MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, sqlBus);
                    }
                }
                string sqlCount = $@"select count(*) from qskjrecord.B_BusDriverBindZT{dtStr}";
                if (Convert.ToInt32(MySqlHelper.ExecuteScalar(CommandType.Text, sqlCount)) > 0)
                {
                    Console.WriteLine(DateTime.Now + "中台《出租车驾驶员绑定》数据已读取成功");
                    return;
                }
                //读取中台《出租车驾驶员绑定》数据
                var str = HttpHelper.GetZtCarDriver(token).Result;
                ZtDataObj<ZtDataResCarDriverInfo> obj = JsonConvert.DeserializeObject<ZtDataObj<ZtDataResCarDriverInfo>>(str);
                if (obj == null || obj.data == null || string.IsNullOrEmpty(obj.data.total) || obj.data.total == "0")
                {
                    Console.WriteLine(DateTime.Now + "读取中台《出租车驾驶员绑定》数据" + str);
                }
                foreach (var item in obj.data.dataArray)
                {
                    string insertSql = $@"insert into qskjrecord.B_TaxiCarDriverZT{dtStr}(car_numbers,name,permit_number,day_no,month_hudi,duty_type)
                                        values('{item.car_numbers}','{item.name}','{item.permit_number}','{item.day_no}','{item.month_hudi}','{item.duty_type}')";
                    MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, insertSql);
                    if (!string.IsNullOrWhiteSpace(item.permit_number))
                    {
                        string dr = cSRedisClient5.Get(item.permit_number);//获取驾驶员信息
                        cSRedisClient5.Set(item.car_numbers, dr);//设置车辆驾驶员信息
                    }
                }
                //大巴数据
                //ZtDataObj<ZtBusDriverBindData> objBus = JsonConvert.DeserializeObject<ZtDataObj<ZtBusDriverBindData>>(str);
                foreach (var item in obj.data.dataArray)
                {
                    string insertSql = $@"insert into qskjrecord.B_BusDriverBindZT{dtStr}(duty_type,permit_number,day_no,name,month_hudi,car_numbers)
                                        values('{item.duty_type}','{item.permit_number}','{item.day_no}','{item.name}','{item.month_hudi}','{item.car_numbers}')";
                    MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, insertSql);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("读取出租车驾驶员绑定排班信息异常" + e.Message);
            }
        }
        /// <summary>
        /// 中台出租车《驾驶员》基础数据
        /// </summary>
        public static void UpdateDriverData()
        {
            if (cSRedisClient5 == null)
            {
                cSRedisClient5 = RedisHelp.GetInstance5();
            }
            if (string.IsNullOrEmpty(token))
            {
                ZtTokenDataInfo response = JsonConvert.DeserializeObject<ZtTokenDataInfo>(HttpHelper.GetZtToken().Result);
                if (response == null)
                {
                    Console.WriteLine("获取token失败");
                    return;
                }
                token = response.data;
                if (string.IsNullOrEmpty(response.data))
                {
                    Console.WriteLine("获取token失败");
                    return;
                }
            }
            try
            {
                //出租数据
                //string dtStrPre = DateTime.Now.AddDays(-5).ToString("yyyyMMdd");
                //string sqlPre = $@"drop table if exists qskjrecord.B_TaxiDriverZT{dtStrPre}";
                //MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, sqlPre);
                string dtStr = DateTime.Now.ToString("yyyyMMdd");
                if (DateTime.Now.Hour < 7)
                {
                    string exists = $@"SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'qskjrecord' AND TABLE_NAME = 'B_TaxiDriverZT{dtStr}';";
                    object resExi = MySqlHelper.ExecuteScalar(CommandType.Text, exists);
                    if (resExi == null || resExi == DBNull.Value)
                    {
                        string sql = $@"create table IF NOT EXISTS qskjrecord.B_TaxiDriverZT{dtStr}
                        (
                           id                   bigint not null auto_increment,
                           id_card              varchar(50),
                           work_numbers         varchar(50),
                           name                 varchar(50),
                           dep                  varchar(50),
                           permit_number        varchar(50),
                           sex                  varchar(50),
                           birthday             varchar(50), 
                           head_url             text, 
                           first_get_time       varchar(50),  
                           phone       varchar(50),  
                           primary key (id)
                        );";
                        MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, sql);
                    }
                    //string sqlPreBus = $@"drop table if exists qskjrecord.B_BusDriverZT{dtStrPre}";
                    //MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, sqlPreBus);
                    string exists1 = $@"SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'qskjrecord' AND TABLE_NAME = 'B_BusDriverZT{dtStr}';";
                    object resExi1 = MySqlHelper.ExecuteScalar(CommandType.Text, exists1);
                    if (resExi1 == null || resExi1 == DBNull.Value)
                    {
                        string sqlBus = $@"create table IF NOT EXISTS qskjrecord.B_BusDriverZT{dtStr}
                        (
                           id                   bigint not null auto_increment,
                           birthday              varchar(50),
                           work_numbers         varchar(50),
                           head_url                 varchar(500),
                           permit_number                  varchar(50),
                           sex        varchar(50),
                           first_get_time                  varchar(50),
                           id_card             varchar(50), 
                           name             varchar(50),  
                           dep       varchar(50),   
                           phone       varchar(50),   
                           primary key (id)
                        );";
                        MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, sqlBus);
                    }
                }
                string sqlCount = $@"select count(*) from qskjrecord.B_BusDriverZT{dtStr}";
                if (Convert.ToInt32(MySqlHelper.ExecuteScalar(CommandType.Text, sqlCount)) > 0)
                {
                    Console.WriteLine(DateTime.Now + "中台中台出租车的《驾驶员》数据已读取成功");
                    return;
                }
                //读取中台出租车的《驾驶员》数据
                var str = HttpHelper.GetZtDriver(token).Result;
                ZtDataObj<ZtDataResDriverInfo> obj = JsonConvert.DeserializeObject<ZtDataObj<ZtDataResDriverInfo>>(str);
                if (obj == null || obj.data == null || string.IsNullOrEmpty(obj.data.total) || obj.data.total == "0")
                {
                    Console.WriteLine(DateTime.Now + "读取中台出租车的《驾驶员》数据" + str);
                }
                foreach (var item in obj.data.dataArray)
                {
                    //cSRedisClient5.Set(item.work_numbers, item.id_card + "_" + item.work_numbers + "_" + item.name + "_" + item.head_url);//出租车驾驶员写入Redis
                    if (string.IsNullOrEmpty(item.permit_number))
                    {
                        item.permit_number = item.work_numbers;
                    }
                    cSRedisClient5.Set(item.id_card, item.id_card + ";" + item.permit_number + ";" + item.name + ";" + item.head_url + ";" + item.phone);//出租车驾驶员写入Redis
                    cSRedisClient5.Set(item.permit_number, item.id_card + ";" + item.permit_number + ";" + item.name + ";" + item.head_url + ";" + item.phone);//出租车驾驶员写入Redis
                    string insertSql = $@"insert into qskjrecord.B_TaxiDriverZT{dtStr}(id_card,work_numbers,name,dep,permit_number,sex,birthday,head_url,first_get_time,phone)
                                        values('{item.id_card}','{item.work_numbers}','{item.name}','{item.dep}','{item.permit_number}','{item.sex}','{item.birthday}','{item.head_url}','{item.first_get_time}','{item.phone}')";
                    MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, insertSql);
                }
                //大巴数据
                //ZtDataObj<ZtBusDriverData> objBus = JsonConvert.DeserializeObject<ZtDataObj<ZtBusDriverData>>(str);
                foreach (var item in obj.data.dataArray)
                {
                    string insertSql = $@"insert into qskjrecord.B_BusDriverZT{dtStr}(birthday,work_numbers,head_url,permit_number,sex,first_get_time,id_card,name,dep,phone)
                                        values('{item.birthday}','{item.work_numbers}','{item.head_url}','{item.permit_number}','{item.sex}','{item.first_get_time}','{item.id_card}','{item.name}','{item.dep}','{item.phone}')";
                    MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, insertSql);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("读取出租车驾驶员信息异常" + e.Message);
            }
        }
        /// <summary>
        /// 中台大巴车《租赁数据》基础数据
        /// </summary>
        public static void ZtBusLeaseRecordData()
        {
            if (string.IsNullOrEmpty(token))
            {
                ZtTokenDataInfo response = JsonConvert.DeserializeObject<ZtTokenDataInfo>(HttpHelper.GetZtToken().Result);
                if (response == null)
                {
                    Console.WriteLine("获取token失败");
                    return;
                }
                token = response.data;
                if (string.IsNullOrEmpty(response.data))
                {
                    Console.WriteLine("获取token失败");
                    return;
                }
            }
            try
            {
                if (cSRedisClient5 == null)
                {
                    cSRedisClient5 = RedisHelp.GetInstance5();
                }
                //string dtStrPre = DateTime.Now.AddDays(-5).ToString("yyyyMMdd");
                //string sqlPre = $@"drop table if exists qskjrecord.B_BusLeaseRecordZT{dtStrPre}";
                //MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, sqlPre);
                string dtStr = DateTime.Now.ToString("yyyyMMdd");
                if (DateTime.Now.Hour < 7)
                {
                    string exists = $@"SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'qskjrecord' AND TABLE_NAME = 'B_BusLeaseRecordZT{dtStr}';";
                    object resExi = MySqlHelper.ExecuteScalar(CommandType.Text, exists);
                    if (resExi == null || resExi == DBNull.Value)
                    {
                        string sql = $@"create table IF NOT EXISTS qskjrecord.B_BusLeaseRecordZT{dtStr}
                        (
                           id                   bigint not null auto_increment,
                           name_hudi              varchar(50),
                           contacts_hudi         varchar(50),
                           belonging_fleet_hudi                 varchar(50), 
                           file_number_hudi        varchar(50),
                           running_route_hudi                  varchar(50),
                           drivers_license_number1_hudi             varchar(50), 
                           id_hudi             varchar(50),  
                           office_phone_number_hudi       varchar(50),  
                           fleet_hudi       varchar(50),  
                           mobile_phone_number_hudi       varchar(50),  
                           time_3_hudi       varchar(50),   
                           time_2_hudi       varchar(50),  
                           time_3__s_hudi       varchar(50),   
                           date_of_birth_hudi       varchar(50),  
                           departure_hudi       varchar(50),  
                           time_1__s_hudi       varchar(50),  
                           department_hudi       varchar(50),  
                           work_permit_number_hudi       varchar(50),  
                           sys_hudi       varchar(50),  
                           driver_1_hudi       varchar(50),  
                           date_1_hudi       varchar(50),  
                           state_hudi       varchar(50),  
                           age_hudi       varchar(50),  
                           remarks_hudi       varchar(50),  
                           driver_classification_hudi       varchar(50),  
                           license_plate_number_hudi       varchar(50),  
                           destination_hudi       varchar(50),  
                           gender_hudi       varchar(50),  
                           residential_telephone_hudi       varchar(50),   
                           driver_hudi       varchar(50),  
                           endtime_hudi       varchar(50),  
                           date_2_hudi       varchar(50),  
                           isview_hudi       varchar(50),  
                           operations_squadron_hudi       varchar(50),  
                           car_owners_hudi       varchar(50),  
                           statistics_date       varchar(50),  
                           drivers_registration_hudi       varchar(50),  
                           driver_3_hudi       varchar(50),  
                           registration_date_hudi       varchar(50),  
                           picture_hudi       varchar(50),  
                           line_hudi       varchar(50),  
                           driver_2_hudi       varchar(50),  
                           drivers_contact_information_hudi       varchar(50),  
                           isbmp_hudi       varchar(50),   
                           tenant_hudi       varchar(50),  
                           drivers_license_number_hudi       varchar(50),  
                           time_2__s_hudi       varchar(50),  
                           time_1_hudi       varchar(50),  
                           note_100_hudi       varchar(50),  
                           issend_hudi       varchar(50),   
                           ifimage_hudi       varchar(50),  
                           stroke_hudi       varchar(300),  
                           date_hudi       varchar(50),  
                           date_3_hudi       varchar(50),  
                           id_number_hudi       varchar(50),  
                           isup_hudi       varchar(50),  
                           starttime_hudi       varchar(50),   
                           primary key (id)
                        );";
                        MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, sql);
                    }
                }
                string sqlCount = $@"select count(*) from qskjrecord.B_BusDriverZT{dtStr}";
                if (Convert.ToInt32(MySqlHelper.ExecuteScalar(CommandType.Text, sqlCount)) > 0)
                {
                    Console.WriteLine(DateTime.Now + "中台大巴车《租赁数据》基础数据已读取成功");
                    return;
                }
                //读取中台大巴车《租赁数据》基础数据
                var str = HttpHelper.GetZtBusLeaseRecord(token).Result;
                ZtDataObj<ZtDataBusLeaseRecord> obj = JsonConvert.DeserializeObject<ZtDataObj<ZtDataBusLeaseRecord>>(str);
                if (obj == null || obj.data == null || string.IsNullOrEmpty(obj.data.total) || obj.data.total == "0")
                {
                    Console.WriteLine(DateTime.Now + "读取中台大巴车《租赁数据》基础数据" + str);
                }
                foreach (var item in obj.data.dataArray)
                {
                    string insertSql = $@"insert into qskjrecord.B_BusLeaseRecordZT{dtStr}(
                                        name_hudi,
                                        belonging_fleet_hudi,
                                        file_number_hudi,
                                        id_hudi,
                                        fleet_hudi,
                                        mobile_phone_number_hudi,
                                        time_2_hudi,
                                        date_of_birth_hudi,
                                        departure_hudi,
                                        department_hudi,
                                        sys_hudi,
                                        date_1_hudi,
                                        state_hudi,
                                        age_hudi,
                                        license_plate_number_hudi,
                                        destination_hudi,
                                        gender_hudi,
                                        residential_telephone_hudi,
                                        driver_hudi,
                                        date_2_hudi,
                                        car_owners_hudi,
                                        statistics_date,
                                        drivers_registration_hudi,
                                        driver_3_hudi,
                                        line_hudi,
                                        driver_2_hudi,
                                        drivers_contact_information_hudi,
                                        drivers_license_number_hudi,
                                        time_1_hudi,
                                        stroke_hudi,
                                        date_hudi,
                                        id_number_hudi)
                                        values('{item.name_hudi}','{item.belonging_fleet_hudi}','{item.file_number_hudi}','{item.id_hudi}','{item.fleet_hudi}','{item.mobile_phone_number_hudi}','{item.time_2_hudi}','{item.date_of_birth_hudi}','{item.departure_hudi}',
                                        '{item.department_hudi}','{item.sys_hudi}','{item.date_1_hudi}','{item.state_hudi}','{item.age_hudi}','{item.license_plate_number_hudi}','{item.destination_hudi}','{item.gender_hudi}','{item.residential_telephone_hudi}','{item.driver_hudi}','{item.date_2_hudi}','{item.car_owners_hudi}','{item.statistics_date}',
                                        '{item.drivers_registration_hudi}','{item.driver_3_hudi}','{item.line_hudi}','{item.driver_2_hudi}','{item.drivers_contact_information_hudi}','{item.drivers_license_number_hudi}','{item.time_1_hudi}','{item.stroke_hudi}','{item.date_hudi}','{item.id_number_hudi}')";
                    MySqlHelper.ExecuteNonQuery(System.Data.CommandType.Text, insertSql);
                    if (!string.IsNullOrWhiteSpace(item.id_number_hudi))
                    {
                        string dr = cSRedisClient5.Get(item.id_number_hudi);//获取驾驶员信息
                        cSRedisClient5.Set(item.license_plate_number_hudi, dr);//设置车辆驾驶员信息
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("中台大巴车《租赁数据》基础数据异常" + e.Message);
            }
        }
    }
}
